#include "httplib.h"
#include <iostream>
#include <fstream>

using namespace httplib;
using namespace std;

int main(void)
{
    Server svr;
    svr.Post("/post", [](const Request &req, Response &res) {
        auto music_file = req.get_file_value("music_file");

        cout << "image file length: " << music_file.content.length() << endl
             << "image file name: " << music_file.filename << endl;
        {
            ofstream ofs(music_file.filename, ios::binary);
            ofs << music_file.content;
        }
        res.set_content("done", "text/plain");
    });
    svr.set_mount_point("/", "./www");
    /// listen
    svr.listen("0.0.0.0", 9089);
}
